package com.moyou.weichat.view;

import android.content.Context;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Handler;
import android.os.PowerManager;
import android.support.annotation.RequiresApi;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;


import com.moyou.weichat.R;
import com.skyfishjy.library.RippleBackground;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Administrator on 2017/2/8 0008.
 * 聊天语音
 */

public class VoiceLayout extends RelativeLayout {

    private View view;

    private Context context;

    private ImageView voiceBtn;

    private Timer timer;

    private RippleBackground bar;


    private TextView voiceTimer;


    private MediaPlayer mediaPlayer = null;


    private static VoiceLayout instance;


    private boolean isStartVoice;

    public static synchronized VoiceLayout getInstance(Context m) {
        if (instance == null) {
            instance = new VoiceLayout(m);
        }
        return instance;
    }



    protected Handler micImageHandler = new Handler() {
        @Override
        public void handleMessage(android.os.Message msg) {

        }
    };

    public VoiceLayout(Context mContext) {
        super(mContext);
        context = mContext;
        initView();
    }

    private void initView() {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (view == null) {
            view = inflater.inflate(R.layout.item_chat_voice, null);
            voiceBtn = (ImageView) view.findViewById(R.id.voice_btn);
            bar = (RippleBackground) view.findViewById(R.id.progress_wheel);
            voiceTimer = (TextView) view.findViewById(R.id.voice_timer);
        }
    }












}
